<?php
namespace app\api\validate;

use think\Validate;

class OrderValidate extends Validate{
    protected $rule =   [
        'id'                        => 'require|integer',
        'order_id|订单ID'           => 'require|integer',
        'user_id|用户ID'            => 'require|integer',
        'to_user_id|用户ID'         => 'integer',
        'admin_id|店铺ID'           => 'require|integer',
        'goods_id|商品ID'           => 'require|integer',
        'group_id|团购商品ID'       => 'require|integer',
        'coupon_id|优惠券ID'        => 'require|integer',
        'chief_id|团长ID'           => 'require',
        'order_group_id|团购订单ID' => 'require|integer',
        'order_gift_id|礼品包订单ID' => 'require|integer',
        'curr|页数'                 => 'require|integer',
        'limit|条数'                => 'require|integer',
        'remarks|备注'              => 'length:1,255',
        'type|订单类型'             => 'require|integer',
        'number|数量'               => 'require|number|gt:0',
        'price|价格'                => 'require|gt:0',
        'chief_number|成团人数'     => 'require|integer',
        'order_type|订单类型'       => 'require|integer',
        'status|订单状态'           => 'require|integer',
        'pay_type|支付方式'         => 'require|integer',
        'star|评分'                 => 'require',
        'content|评价内容'          => 'require',
        'img|图片'                  => 'require|image',
    ];
    
    protected $scene = [
        'add'             => ['user_id', 'admin_id', 'goods_id', 'remarks', 'number', 'price'],
        'order_list'      => ['user_id', 'status', 'curr', 'limit', 'admin_id'],
        'show'            => ['order_id'],
        'pay_order'       => ['order_id'],
        'pay_order_group' => ['order_group_id'],
        'pay_order_gift'  => ['order_gift_id'],
        'goods_order_add' => ['user_id', 'admin_id', 'to_user_id', 'remarks', 'price', 'pay_type', 'goods_id', 'number'],
        'group_order_add' => ['user_id', 'admin_id', 'group_id', 'to_user_id', 'chief_id', 'remarks', 'price', 'number', 'chief_number', 'pay_type'],
        'order_gift_add'  => ['user_id', 'admin_id', 'gift_id', 'to_user_id', 'remarks', 'price', 'number', 'pay_type'],
        'pay_card'        => ['user_id', 'number', 'admin_id'],
        'evaluate'        => ['order_id', 'star', 'content', 'user_id', 'order_type'],
        'pay_order_make'  => ['order_id', 'pay_type'],
        'img'             => ['img'],
        'gold_order_add'  => ['user_id', 'admin_id', 'remarks', 'price', 'goods_id', 'number'],
    ];
}